import Vue from 'vue'
import Router from 'vue-router'
// import HelloWorld from '@/components/HelloWorld'
import Login from "../views/Login/Login.vue"
const originalPush = Router.prototype.push

Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
Vue.use(Router)

// export default new Router({
//   routes: [
//     {
//       path: '/',
//       name: 'HelloWorld',
//       component: HelloWorld
//     }
//   ]
// })

const routes = [
  // {
  //   path: '/',
  //   name: 'HelloWorld',
  //   component: HelloWorld
  // }
  {
    path: '/',
    name: 'Login',
    component: Login
  },
  {
  	  path:"/home",
  	  name:"Home",
      redirect:"/home/index",
  	  component:()=>import("../views/Home/Home.vue"),
  	  children:[
        //首页展示
        {
          path:"/home/index",
          component:()=>import("../views/Login/index.vue")
        },
        // 管理员界面内容
  		  {
  			  path:"/home/member",
  			  component:()=>import("../views/Member/Member.vue")
  		  },
        {
          path:"/home/memberInfo",
          component:()=>import("../views/Member/MemberInfo.vue")
        },
        //轮播界面内容
        {
          path:"/home/rotation",
          component:()=>import("../views/indexClient/Rotation.vue")
        },
        {
          path:"/home/classify",
          component:()=>import("../views/Datamgr/Classify.vue")
        },
        {
          path:"/home/goods",
          component:()=>import("../views/Datamgr/Goods.vue")
        },
        {
          path:"/home/orders",
          component:()=>import("../views/Order/Orders.vue")
        },
        {
          path:"/home/stock",
          component:()=>import("../views/Order/Stock.vue")
        },
        {
          path:"/home/sales",
          component:()=>import("../views/Order/Sales.vue")
        }
  	  ]
  }
]

const router = new Router({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
